package com.cf.r952_ak;

import java.io.*;

public class b {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(System.out);
        in.nextToken(); int t = (int) in.nval;
        while (t-- > 0) {
            in.nextToken(); int n = (int) in.nval;
            int ans = Integer.MIN_VALUE;
            int tmp = Integer.MIN_VALUE;
            for (int i = 2; i <= n; i++) {
                int x = compute(i, n);
                if (tmp < x) {
                    ans = Math.max(ans, i);
                    tmp = x;
                }

            }
            out.println(ans);
        }
        out.close();
        out.close();
        br.close();
    }

    public static int compute(int x, int n) {
        int ans = 0;
        int tmp = x;
        while (tmp <= n) {
            ans += tmp;
            tmp += x;
        }
        return ans;
    }
}
